﻿@model IEnumerable<Qu.SeniorProject.Model.Document>

@{
    ViewBag.Title = "Guide and Templates";

    string semester1 = "Fall";
    string semester2 = "Spring";
    
    if (!Qu.SeniorProject.Model.DocumentRepository.IsFallSemester())
    {
        semester1 = "Spring";
        semester2 = "Fall";
    }
}

@DispalyDocumentsList(semester1)
@DispalyDocumentsList(semester2)

@helper DispalyDocumentsList(string semester)
{
    string major = ViewBag.Major as string;
    
    <h2>Guide and Templates for @semester Semester</h2>
    
    <table>

    @foreach (var item in Model)
    {
        if (item.Semester == semester && (major == null || item.CseProgram == null || item.CseProgram == major))
        {
            <tr>
                <td>
                    @Html.ActionLink(item.Name, "Index", "document", new { id = item.DocumentId }, null)
                </td>
            </tr>
        }
    }

    </table>
    
    if (semester == "Fall")
    {
        <div style="text-align: center;">
            <img src="@Url.Content("~/Content/SeniorProject-FallLogo.png")" width="90%" />
        </div>
    }
    
    <br />
}